<template>
  <div class="legalList">
      <!-- 面包屑 -->
      	<el-breadcrumb separator=">" class="crumbs">
      	  	<el-breadcrumb-item :to="{ path: '/legalList'}">权限列表</el-breadcrumb-item>
      	</el-breadcrumb>
      <!-- 查询条件 -->
      <el-row :gutter="20">
        <el-col :span="11">
          <el-col :span="8" class="inquireText">权限代码</el-col>
          <el-col :span="16"><el-input placeholder="请输入内容" v-model="permissionCode"></el-input></el-col>
        </el-col>
        <el-col :span="11">
            <el-col :span="8" class="inquireText">权限名称</el-col>
            <el-col :span="16"><el-input placeholder="请输入内容" v-model="permissionName"></el-input></el-col>
        </el-col>
        <el-col :span="2"><el-button @click="inquire">查询</el-button></el-col>        
      </el-row>
      <!-- 列表展示 -->
      <el-table :data="tableData" style="width: 100%" stripe class="table">
        <el-table-column prop="permissionCode" label="权限代码" width="220"></el-table-column>
        <el-table-column  prop="permissionName" label="权限名称" width="220"></el-table-column>
        <el-table-column  prop="permissionDescription" label="权限描述"></el-table-column>
      </el-table>
      <!-- 分页 -->
      <el-pagination
      class="sorter"
      @size-change=""
      @current-change="pageChange"
      :current-page.sync="currentPage"
      :page-size="10"
      layout="prev, pager, next, jumper"
      :total="totalCount">
    </el-pagination>
  </div>
</template>
<script>
export default {
  name: 'legalList',
  data () {
    return {
      tableData:[],
      currentPage:1,
      totalCount:1,
      permissionCode:'',
      permissionName:''
    }
  },
  methods:{
		inquire() {
      var params = {
        permissionCode:this.permissionCode,
        permissionName:this.permissionName
      };
      $.post(this._path + '/permission/selectPermissionPageList',params,(res)=>{
        this.tableData = res.data.permissionList;
        this.totalCount = res.data.totalCount;
      })
    },
    pageChange (val) {
      var params = {
        currentPage:val,
        permissionCode:this.permissionCode,
        permissionName:this.permissionName
      };
      $.post(this._path + '/permission/selectPermissionPageList',params,(res)=>{
        this.tableData = res.data.permissionList;
        this.totalCount = res.data.totalCount;
      })
    }
	},
	created () {
    $.post(this._path + '/permission/selectPermissionPageList',{},(res)=>{
      this.tableData = res.data.permissionList;
      this.totalCount = res.data.totalCount
    })
	}
}
</script>

<style scoped lang="scss">
@import "./../style/legalList.scss"
</style>
